home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 007 / checklpt.arc / README < prev    next >
Encoding:
Text File  |  1987-05-01  |  5.2 KB  |  120 lines

  1. Documentation for CHKLPT.EXE and COPYLPT.EXE
  2.  
  3. 1.  Summaries.
  4.  
  5. a.  Program chklpt
  6.  
  7.     Usage: chklpt PRINTER
  8.            where PRINTER is (upper, lower or mixed case)
  9.               PRN, 1 or LPT1 for LPT1,
  10.               2 or LPT2 for LPT2 or
  11.               3 or LPT3 for LPT3.
  12.     Returns ERRORLEVEL   0 if PRINTER is available,
  13.                          1 if PRINTER is not available
  14.                        100 for certain system errors.
  15.  
  16.  
  17.     Program copylpt
  18.  
  19.     Usage: copylpt filename [PRINTER]
  20.            where filename is file to be copied (upper, lower or mixed case)   
  21.         and optional argument PRINTER is the printer to copy to
  22.               (upper, lower or mixed case)
  23.               PRN, 1 or LPT1 for LPT1,
  24.               2 or LPT2 for LPT2 or
  25.               3 or LPT3 for LPT3.
  26.            If PRINTER is not specified, copy to LPT1
  27.     Returns ERRORLEVEL     0 if file filename was copied to the printer
  28.                            1 if PRINTER is not available
  29.                            2 if PRINTER is available, but file filename is    
  30.                                not available.
  31.                            3 if both PRINTER and file filename are
  32.                              available, but there was some error copying
  33.                              filename to PRINTER.
  34.                          100 for certain system errors.
  35.  
  36.  
  37. 2.  Discussion of the programs
  38.  
  39.      I wanted to copy the public domain file PRNTIBM.DAT from file
  40. PRNTIBM.ARC, which contains the high order IBM display characters, to my Epson
  41. FX-85 in my AUTOEXEC.BAT file.  I often don't turn my printer on when I boot,
  42. so I didn't want to stop the batch file with DOS' standard "Abort, ignore or
  43. retry" prompt.  These programs will let my batch file continue, but inform it
  44. about the printer.  They require DOS 2.0 or later to run.  If you try them
  45. under DOS 1.X, they will not give an ERRORLEVEL of 1 if PRINTER is not
  46. available.
  47.  
  48.      If either program sets ERRORLEVEL to 1, you can be quite sure that the
  49. printer you specified is not available.  It may not exist; it may be off; it
  50. may be on but off-line; it may be out of paper; it may be busy; or it may have
  51. yet another problem.  Your batch file can take whatever action you want it to. 
  52. It can ECHO a message; it can set an environment variable which you can test
  53. later with an "IF %<var>%=..." command; it can pause to let you correct the
  54. fault; it can skip or modify programs which would normally use the printer; or
  55. it can do something else which fits your needs.
  56.  
  57.      COPYLPT can look in several directories for the file to copy.  If you
  58. specify either a drive or a path which begins with a backslash, it merely
  59. looks where you say.  Otherwise, it first looks in the default directory.  It
  60. then looks in the DOS environment.  If there is a variable with the same name
  61. as the file extension, it looks at its values for other directories with the
  62. same syntax as the DOS PATH command.  For example, if you also wanted to copy
  63. C:\PDATA\PRNTIBM.DAT and C:\EPSONSET.DAT, you could set an environment
  64. variable DAT=c:\;c:\pdata.  If it still hasn't found the file, it then looks
  65. in the directories specified by the DOS PATH.  Finally, if you are using DOS
  66. 3.0 or later, it looks in the directory which contains COPYLPT.EXE.
  67.  
  68.      Because I wanted to use COPYLPT for a big printer set-up string, I forced
  69. it to copy in the binary mode, which means that it will ignore end of file
  70. markers and copy until it completes the file's DOS directory size.
  71.  
  72.  
  73. 3.  Technical stuff.
  74.  
  75.      I compiled these programs with Lattice C, Version 3.10+.  There are a lot
  76. of functions in them which may be specific to that compiler.  I tried to
  77. describe them in the notes at the beginning of the programs, but I am not sure
  78. that I found them all.
  79.  
  80.      There are three separate functions which you may find useful for
  81. themselves.
  82.  
  83.      CHECKLPT.C contains two functions, FILE_check_lpt_available and
  84. handle_check_lpt_available.  They use DOS function 4407H, check the status of
  85. an output device driver. for LPT1, LPT2 or LPT3.  These functions temporarily
  86. take over the DOS critical error handler in case some version of DOS decides
  87. that opening or checking a device which doesn't exist is a critical error.  I
  88. got the idea from a public domain CLIPPER program which I have mislaid, so I
  89. can not give its author proper credit.
  90.  
  91.      FOPEN1.C contains the function fopene_program which does all the path
  92. searching which I described above.
  93.  
  94.      YESORNO.C contains the function yesorno, which gets a non-redirectible
  95. response to a question.
  96.  
  97.  
  98. 4.  File list for CHECKLPT.ARC
  99.  
  100. Filename        Comment
  101. --------        -----------------------------------------------------------
  102. CHECKLPT.C      Function - is printer available?
  103. CHKLPT.C        Source for CHKLPT.EXE
  104. CHKLPT.EXE      Program - printer available ERRORLEVEL
  105. COPYLPT.C       Source for COPYLPT.EXE
  106. COPYLPT.EXE     Program - copy file to printer with availability ERRORLEVEL
  107. FOPEN1.C        Function - extended fopen
  108. README          This file
  109. YESORNO.C       Function - non-redirectible yes or no
  110.  
  111.  
  112. 5.  Disclaimer.
  113.  
  114.      I am not responsible for any bad things these programs might do.  Use
  115. them at your own risk.
  116.  
  117.  
  118. Lew Paper
  119. 4/30/87
  120.